<%@ taglib uri="/tags/struts-bean" prefix="bean" %>
<%@ taglib uri="/tags/struts-html" prefix="html" %>
<%@ taglib uri="/tags/struts-logic" prefix="logic" %>
<%@ taglib uri="/tags/c" prefix="c" %>
<%@ page import="java.text.*"%>
<%@ page import="java.util.*"%>
<%@ page import="java.lang.*"%>
<%@ page import="com.solution.webconstant.PermissionConstants" %>
<%
	HashMap permissionMap = ((HashMap)(session.getAttribute("userPermissionsInfo")));
%>
<script language="JavaScript">
function fnUpdate()
{
	document.userForm.screen_type.value="Edit";
	document.userForm.action='/updateUser.do?';
	document.userForm.submit();
}
</script>
<script language="JavaScript" src="js/Calendar.js" type="text/JavaScript"></script>
<html:form action="/user">
	<html:hidden property="screen_type"/>
	<html:hidden property="user_id" />
	<table width="550" align="center" border="0" cellspacing="0" cellpadding="0">
		<tr>
			<td>&nbsp;</td>
		</tr>
		<tr>
			<logic:equal name="userForm" property="screen_type" value="Edit">
 				<td class="heading1">Edit User</td>
 			</logic:equal>
 			<logic:equal name="userForm" property="screen_type" value="View">
 				<td class="heading1">View User</td>
 			</logic:equal>
		</tr>
		<tr>
			<td valign="top">&nbsp;</td>
		</tr>
		<tr>
			<td valign="top"><jsp:include page="showErrorMessage.jsp"/></td>
		</tr>
	  	<tr>
			<td>
				<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
					<tr>
						<td align="left" valign="top" class="inputtext">First Name<font class="asterix">*</font></td>
						<td valign="middle" ><input type="text" name="first_name" id="first_name" class="form1" 
						value='<bean:write name="userForm" property="first_name"/>'/></td>
					</tr>
					<tr>
						<td align="left" valign="top" class="inputtext">Last Name<font class="asterix">*</font></td>
						<td valign="middle"><input type="text" name="last_name" id="last_name" class="form1"
						value='<bean:write name="userForm" property="last_name"/>'/></td>
					</tr>
					<tr>
						<td align="left" valign="top" class="inputtext">User Name<font class="asterix">*</font></td>
						<td valign="middle" ><input type="text" name="user_name" id="user_name" class="form1"
						value='<bean:write name="userForm" property="user_name"/>' readonly="readonly"/></td>
					</tr>
					<tr>
						<td align="left" valign="top" class="inputtext">Exam Type</td>
						<td valign="middle">
							<html:select property="exam_type" styleId="exam_type" styleClass="form3">
							<html:option value="">--Please Select--</html:option>
							<logic:present name="userForm" property="exam_type_list">
							<logic:iterate name="userForm" property="exam_type_list" id="examType" >
							<bean:define id="dID" name="examType" property="id" />
							<html:option  value="<%=dID.toString()%>"><bean:write name="examType" property="name"/></html:option>		
							</logic:iterate>
							</logic:present>
							</html:select>
						</td>	
					</tr>
					<tr>
						<td align="left" valign="top" class="inputtext">User Type<font class="asterix">*</font></td>
						<td valign="middle">
							<html:select styleClass="form3" property="user_type" styleId="user_type" style=":width=25%" disabled="true">
								<html:option value="1">Examiner</html:option>
								<html:option value="2">Examinee</html:option>
							</html:select>
						</td>
					</tr>
					<tr>
						<td align="left" valign="top" class="inputtext">Status<font class="asterix">*</font></td>
						<td valign="middle">
							<html:select styleClass="form3" property="status" styleId="status" style=":width=25%">
								<html:option value="1">Active</html:option>
								<html:option value="2">InActive</html:option>
							</html:select>
						</td>
					</tr>
					<tr>
						<td colspan="4" valign="top"  ></td>
					</tr>
					<tr>
						<td height="25" colspan="4" align="center" valign="top" >&nbsp;</td>
					</tr>
					<tr>
						<td colspan="4" valign="top"  bgcolor="#CCCCCC"><img src="images/zero.gif" width="1" height="1" /></td>
					</tr>
					<tr>
						<td height="25" colspan="4" align="center" valign="top" >&nbsp;</td>
					</tr>
					<logic:equal name="userForm" property="screen_type" value="Edit">
					<tr>
       	 				<td height="25" colspan="4" align="center" valign="top">
       	 					<input type="button" class="imageButton" value="Submit" onClick="JavaScript:fnUpdate()">
       	 				</td>
      				</tr>
      				</logic:equal>
      				<tr>
						<td height="25" colspan="4" align="center" valign="top" >&nbsp;</td>
					</tr>
				</table>
          	</td>
		</tr>
      </table>
      <logic:equal name="userForm" property="screen_type" value="View">
		<script language="JavaScript">	
			var elements = document.forms[0].elements;
			var type = "";
			for(j=0;j<elements.length;j++){
				type = elements[j].type;
				if(type == 'text' || type == 'select-one' || type == 'radio' || type == 'checkbox' || type == 'button' || type == 'textarea') {
					elements[j].disabled=true;
				}
			}
		</script>
	</logic:equal>
</html:form>